import { request } from "../util/request.js"
export default {
    async login({ username, password }) {
        const data= await request({
            type: "GET",
            url: "/api/users/login",
            data: { username, password }
        });
        this.setToken(data.token);
        return data;
    },
    async reg({ username, password }) {
        return await request({
            url: "/api/users/reg",
            data: { username, password }
        });
    },
    setToken(data) {
        return sessionStorage["ut"] = data;
    },
    getToken() {
        return sessionStorage["ut"];
    }
}